<template>
  <div>
    <V-CommonHeaderLeft>
      <div id="app">
        <el-row>
          <!-- 头部 -->
          <div class="header">
            <el-col :span="4" class="header-nav">
              <router-link to="/">首页&nbsp;&nbsp;/</router-link>
              <router-link to="/">营销&nbsp;&nbsp;/</router-link>
              <router-link to="/">优惠券&nbsp;&nbsp;/</router-link>
              <router-link to="/">优惠券详情</router-link>
            </el-col>
          </div>
        </el-row>
        <div class="contents">
          <div class="contents-header">
            <h3>| 基本信息</h3>
            <p>(必填)</p>
          </div>
          <div class="contents-center">
            <div class="center-left">
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">优惠券类型</el-col>
                <el-col :span="20">
                  <el-select v-model="value" placeholder="满减券" style="width:510px;">
                    <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    ></el-option>
                  </el-select>
                </el-col>
              </el-row>
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">优惠券名称</el-col>
                <el-col :span="20">
                  <el-input
                    type="text"
                    placeholder="请输入优惠券名称，≤12字"
                    v-model="text"
                    maxlength="12"
                    show-word-limit
                    style="width:510px;"
                  ></el-input>
                </el-col>
              </el-row>
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">有效期</el-col>
                <el-col :span="20">
                  <el-date-picker
                    v-model="value1"
                    type="daterange"
                    range-separator="~"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    style="width:510px;"
                  ></el-date-picker>
                </el-col>
              </el-row>
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">优惠券名称</el-col>
                <el-col :span="20">
                  <el-input v-model="inputMian" placeholder="优惠券面值" style="width:510px;"></el-input>
                </el-col>
              </el-row>
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">总数量</el-col>
                <el-col :span="20">
                  <el-input v-model="inputCount" placeholder="请输入优惠券允许领取的总数量" style="width:510px;"></el-input>
                </el-col>
              </el-row>
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">每人限领</el-col>
                <el-col :span="20">
                  <el-input v-model="inputMax" placeholder="每人限领≤5" style="width:510px;"></el-input>
                </el-col>
              </el-row>
              <el-row class="left-tableRow">
                <el-col :span="4" class="size">使用门槛</el-col>
                <el-col :span="20">
                  <span style="margin-right:10px">单笔订单满</span>
                  <el-input v-model="inputMax" placeholder="请输入金额" style="width:250px;"></el-input>
                  <span style="margin-left:10px">元可用</span>
                </el-col>
              </el-row>
              <el-row class="left-tableRow-height">
                <el-col :span="4" class="sizeInfo">使用说明</el-col>
                <el-col :span="20">
                  <el-input
                    type="textarea"
                    placeholder="请输入相关说明，不编辑默认显示以下内容：1、全品类可用；2、可与促销活动叠加使用;3、不可抵扣运费；4、使用后不予退还"
                    v-model="textarea"
                    maxlength="50"
                    show-word-limit
                  ></el-input>
                </el-col>
              </el-row>
            </div>
            <div class="center-right">11111111111</div>
          </div>
          <div class="contents-footer">
            <div class="contents-footer-top">
              <h3>| 基本信息</h3>
              <p>(必填)</p>
            </div>
            <div class="contents-footer-center">
              <div class="radio">
                <el-radio v-model="radio" label="1" @click.native="radio1()">备选项</el-radio>
                <el-radio v-model="radio" label="2" @click.native="radio2()">备选项</el-radio>
              </div>
              <div class="list" v-if="showList">
                <el-row class="footer-tableRow">
                  <el-col :span="4">序号</el-col>
                  <el-col :span="4">客户名称</el-col>
                  <el-col :span="4">客户类型</el-col>
                  <el-col :span="4">客户区域</el-col>
                  <el-col :span="4">状态</el-col>
                  <el-col :span="4">操作</el-col>
                </el-row>
                <el-row class="footer-tableData">
                  <el-col :span="4" class="borderRight">序号</el-col>
                  <el-col :span="4" class="borderRight">客户名称</el-col>
                  <el-col :span="4" class="borderRight">客户类型</el-col>
                  <el-col :span="4" class="borderRight">客户区域</el-col>
                  <el-col :span="4" class="borderRight">状态</el-col>
                  <el-col :span="4">操作</el-col>
                  <el-col class="footerAdd" @click.native="statics()">+添加客户</el-col>
                </el-row>
              </div>
            </div>
          </div>
        </div>
        <!-- 弹框||||||||||||||||||||||||||||||||||||||||||||||||||| -->
        <div class="tanKuang" v-if="showTan">
          <el-row class="tanKuang-header">
            <el-col :span="1" :offset="11">客户</el-col>
            <el-col :span="1" :offset="11" class="xx" @click.native="hidden()">X</el-col>
          </el-row>
          <el-row class="tanKuang-input">
            <el-col :span="5">
              <input
                type="search"
                name
                id
                class="search"
                placeholder="请输入客户名称/手机号"
                :class="{border:isBorder}"
                @click="search()"
              >
            </el-col>
            <el-col :span="4" style="margin-left:80px;">
              <el-select v-model="valueSe" filterable placeholder="客户类型">
                <el-option
                  v-for="item in optionsSe"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="4" style="margin-left:15px;width:145px;">
              <el-select
                v-model="valueAdr"
                filterable
                placeholder="请选择所属区域"
                style="margin-left:15px;"
              >
                <el-option
                  v-for="item in optionsAdr"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="4" style="margin-left:15px;">
              <el-select
                v-model="valueAdr"
                filterable
                placeholder="最近未下单"
                style="margin-left:15px;width:145px;"
              >
                <el-option
                  v-for="item in optionsAdr"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
            <el-col :span="4" style="margin-left:15px;">
              <el-select v-model="valueAdr" filterable placeholder="请选择所属区域" style="width:145px;">
                <el-option
                  v-for="item in optionsAdr"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-col>
          </el-row>
          <el-table
            ref="multipleTable"
            :data="tableData"
            tooltip-effect="dark"
            style="width: 100%;margin-top:20px;"
            @selection-change="handleSelectionChange"
            class="tableScroll"
          >
            <el-table-column type="selection" width="55"></el-table-column>
            <el-table-column prop="name" label="姓名" width="120"></el-table-column>
            <el-table-column prop="tel" label="手机号" width="150"></el-table-column>
            <el-table-column prop="type" label="类型" show-overflow-tooltip></el-table-column>
            <el-table-column prop="address" label="区域" width="120"></el-table-column>
            <el-table-column prop="order" label="最近下单" show-overflow-tooltip></el-table-column>
            <el-table-column prop="time" label="注册时间" show-overflow-tooltip></el-table-column>
          </el-table>
          <!-- 引入公共分页 -->
        </div>
        <div class="footer">
          <div class="footer-one"></div>
          <div class="footer-two">
            <router-link to="/">取消</router-link>
            <router-link to="/">保存</router-link>
          </div>
        </div>
      </div>
    </V-CommonHeaderLeft>
  </div>
</template>

<script>
import VCommonHeaderLeft from './../common/vCommonHeaderLeft/VCommonHeaderLeft'
export default {
  components: {
    VCommonHeaderLeft
  },
  data () {
    return {
      // 弹层
      showTan: false,
      showList: true,
      // 优惠券类型
      options: [{
        value: '选项1',
        label: '黄金糕'
      }],
      value: '',
      value1: '',
      text: '',
      inputMian: '',
      inputCount: '',
      textarea: '',
      inputMax: '',
      radio: '1',
      optionsSe: [
        {
          value: '选项1',
          label: '代理商'
        }, {
          value: '选项2',
          label: '批发商'
        }, {
          value: '选项3',
          label: '零售'
        }],
      valueSe: '',
      optionsAdr: [
        {
          value: '选项1',
          label: '代理商'
        }, {
          value: '选项2',
          label: '批发商'
        }, {
          value: '选项3',
          label: '零售'
        }],
      valueAdr: '',
      isBorder: false,
      tableData: [
        {
          name: '小芳',
          tel: '15588511085',
          type: '代理商',
          address: '北京',
          order: '2019-12-30 14:25:00',
          time: '2019-06-16'
        }, {
          name: '小芳',
          tel: '15588511085',
          type: '代理商',
          address: '北京',
          order: '2019-12-30 14:25:00',
          time: '2019-06-16'
        }, {
          name: '小芳',
          tel: '15588511085',
          type: '代理商',
          address: '北京',
          order: '2019-12-30 14:25:00',
          time: '2019-06-16'
        }, {
          name: '小芳',
          tel: '15588511085',
          type: '代理商',
          address: '北京',
          order: '2019-12-30 14:25:00',
          time: '2019-06-16'
        }, {
          name: '小芳',
          tel: '15588511085',
          type: '代理商',
          address: '北京',
          order: '2019-12-30 14:25:00',
          time: '2019-06-16'
        }, {
          name: '小芳',
          tel: '15588511085',
          type: '代理商',
          address: '北京',
          order: '2019-12-30 14:25:00',
          time: '2019-06-16'
        }],
      multipleSelection: []
    }
  },
  methods: {
    search () {
      this.isBorder = !this.isBorder
      // console.log(111)
    },
    statics () {
      this.showTan = true
    },
    hidden () {
      this.showTan = false
    },
    toggleSelection (rows) {
      if (rows) {
        rows.forEach(row => {
          this.$refs.multipleTable.toggleRowSelection(row)
        })
      } else {
        this.$refs.multipleTable.clearSelection()
      }
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    radio1 () {
      this.showList = true
    },
    radio2 () {
      this.showList = false
    }
  }
}
</script>

<style lang="scss" scoped>
#app {
  width: 100%;
  background-color: #f2f5f7;
  height: 100%;
  padding: 15px 10px 0px 10px;
}
.header {
  height: 45px;
  .header-nav {
    line-height: 30px;
    font-size: 12px;
    display: flex;
    justify-content: space-around;
    padding-left: 10px;
    span {
      display: inline-block;
      margin-left: 10px;
    }
    a {
      color: #999999;
    }
    a:hover {
      color: #20ade5;
    }
  }
  .header-img {
    width: 25px;
    height: 25px;
    border-radius: 5px;
    border: 1px solid #dce4e7;
  }
}
.header-nav a:nth-child(4) {
  color: #333;
}
.header-nav a:nth-child(4):hover {
  color: #333;
}
.contents {
  width: 100%;
  height: 500px;
  background-color: #fff;
  padding: 25px 0px 0px 0px;
  overflow-x: hidden;
  overflow-y: scroll;
}
.contents-header {
  display: flex;
  border-bottom: 1px solid #e3e3e3;
  margin: 0px 20px 0px 20px;
  padding-bottom: 10px;
}
.contents-header > h3 {
  font-size: 16px;
}
.contents-header > p {
  display: block;
  margin: 10px 0px 0px 10px;
  color: #b3b3b3;
  font-size: 12px;
}
.contents-center {
  display: flex;
}
.center-left {
  width: 60%;
}
.left-tableRow {
  margin-top: 20px;
}
.left-tableRow span {
  font-size: 12px;
  margin-right: 10px;
}
.size {
  font-size: 12px;
  text-align: center;
  margin-top: 10px;
}
.left-tableRow-height /deep/ .el-textarea__inner {
  font-size: 12px;
  margin-top: 20px;
  height: 70px;
  width: 510px;
  padding-top: 15px;
}
.sizeInfo {
  font-size: 12px;
  text-align: center;
  margin-top: 45px;
}
.contents-footer-top {
  display: flex;
  border-bottom: 1px solid #e3e3e3;
  margin: 0px 20px 0px 20px;
  padding-bottom: 10px;
}
.contents-footer-top > h3 {
  font-size: 16px;
}
.contents-footer-top > p {
  display: block;
  margin: 10px 0px 0px 10px;
  color: #b3b3b3;
  font-size: 12px;
}
.contents-footer-center {
  padding-left: 20px;
  margin-bottom: 200px;
}
.radio {
  margin: 15px 0px 10px 0px;
}
.footer-tableRow {
  border: 1px solid #e3e3e3;
  font-size: 12px;
  color: #666;
  background-color: #fcfcfc;
  height: 50px;
  line-height: 50px;
  text-align: center;
}
.footer-tableData {
  border: 1px solid #e3e3e3;
  border-top: 0px;
  font-size: 12px;
  color: #666;
  height: 50px;
  line-height: 50px;
  text-align: center;
}
.borderRight {
  border-right: 1px solid #e3e3e3;
}
.footerAdd {
  color: #20ade5;
  font-weight: bold;
  border: 1px solid #e3e3e3;
  border-top: 0;
  cursor: pointer;
}
.tanKuang {
  width: 1000px;
  height: 515px;
  border: 1px solid;
  position: absolute;
  top: 100px;
  left: 170px;
  background-color: #fff;
  z-index: 5;
}
.tanKuang-header {
  height: 50px;
  line-height: 50px;
  background-color: #f5f5f5;
}
.xx {
  color: #828282;
  cursor: pointer;
}
.search {
  border: 1px solid #dcdfe6;
  width: 270px;
  height: 40px;
  border-radius: 5px;
  text-indent: 1em;
}
.search::input-placeholder {
  color: #bdbdbd;
} /* 有些资料显示需要写，有些显示不需要，但是在编辑器webstorm中该属性不被识别 */
::-webkit-input-placeholder {
  /* WebKit browsers */
  color: #c0c4cc;
}
.search:hover {
  border-color: #c0c4cc;
}
.tanKuang-input {
  padding: 10px 0px 0px 10px;
}
.border {
  border-color: #20ade5;
}
.tanKuang /deep/ .el-table th {
  background-color: #fafafa;
}
.tableScroll {
  overflow-x: hidden;
  overflow-y: scroll;
  height: 350px;
}
.footer {
  background-color: #fff;
  // padding: 50px 0px 0px 0px;
  height: 62px;
  position: fixed;
  bottom: 10px;
  width: 90%;
  right: 10px;
  margin-top: 15px;
}
.footer-one {
  padding-top: 10px;
  border-top: 1px solid #e3e3e3;
}
.footer-two {
  display: flex;
  margin-left: 70%;
}
.footer-two a {
  display: block;
  width: 150px;
  height: 40px;
  color: #37b5e8;
  text-align: center;
  line-height: 40px;
  border-radius: 5px;
}
.footer-two a:nth-child(1) {
  border: 1px solid;
}
.footer-two a:nth-child(2) {
  background-color: #37b5e8;
  color: #fff;
  margin-left: 10px;
}
</style>
